Manager helping with path finding and resource loading. More...
Manager helping with path finding and resource loading.
It uses 3 keywords for all paths it manipulates :
Transformations from one path to another use these keywords :
void nkResources::ResourceManager::setWorkingPath | ( | const nkMemory::StringView & | path | ) |
Sets the working path.
path | The path of the wanted path, relative to the path from where the software is launched. |
void nkResources::ResourceManager::setWorkingPathAbsolute | ( | const nkMemory::StringView & | path | ) |
Sets the working path.
path | The path of the wanted path, absolute. |
nkMemory::String nkResources::ResourceManager::getWorkingPath | ( | ) | const |
nkMemory::String nkResources::ResourceManager::getWorkingPathAbsolute | ( | ) | const |
nkMemory::String nkResources::ResourceManager::getLaunchedPath | ( | ) | const |
void nkResources::ResourceManager::setLaunchedPath | ( | const nkMemory::StringView & | path | ) |
Allows to override the path from which the program is launched.
nkMemory::String nkResources::ResourceManager::getRelativeFromAbsolute | ( | const nkMemory::StringView & | absolutePath | ) | const |
Converts a path, from absolute, to a path relative to the launched path.
absolutePath | The absolute path to convert. |
nkMemory::String nkResources::ResourceManager::getAbsoluteFromRelative | ( | const nkMemory::StringView & | relativePath | ) | const |
Converts a path, from relative to the launched directory, to absolute.
relativePath | The relative path to convert. |
nkMemory::String nkResources::ResourceManager::getRelativeFromWorkingDir | ( | const nkMemory::StringView & | workingPath | ) | const |
Converts a path, from relative to the working directory, to relative to the launched path.
workingPath | The path relative to the working directoy to convert. |
nkMemory::String nkResources::ResourceManager::getAbsoluteFromWorkingDir | ( | const nkMemory::StringView & | workingPath | ) | const |
Converts a path, from relative to the working directory, to absolute.
workingPath | The path relative to the working directoy to convert. |
nkMemory::String nkResources::ResourceManager::getFromWorkingDirFromRelative | ( | const nkMemory::StringView & | relativePath | ) | const |
Converts a path, from relative to the launched directory, to relative to the working directory.
relativePath | The path relative to the launched path to convert. |
nkMemory::String nkResources::ResourceManager::getFromWorkingDirFromAbsolute | ( | const nkMemory::StringView & | absolutePath | ) | const |
Converts a path, from absolute, to relative to the working directory.
absolutePath | The absolute path to convert. |
bool nkResources::ResourceManager::checkFileExists | ( | const nkMemory::StringView & | filePathAbs | ) | const |
Checks if a file exists for a certain path.
filePathAbs | The absolute path to check. |
void nkResources::ResourceManager::checkFolderExists | ( | nkMemory::String | path | ) |
Checks if a folder exists for a certain path.
path | The absolute path to check. |
nkMemory::Buffer nkResources::ResourceManager::loadFileIntoMemory | ( | const nkMemory::StringView & | filePathAbs, |
bool | silent = false |
||
) |
Loads a file into memory.
filePathAbs | The path to the file, absolute. |
silent | If a failure in finding the requested file should not be logged. True for no logging, false otherwise. |